<template>
  <div class="run-container">
    <div class="run-core">
      <el-card class="run-card">
        <el-table
          ref="multipleTable"
          :data="page.records"
          tooltip-effect="dark"
          style="width: 100%">
          <el-table-column prop="id" label="编号" min-width="15%" align="center"></el-table-column>
          <el-table-column prop="reviewDate" label="通过时间" align="center"  min-width="8%"></el-table-column>
          <el-table-column prop="name" label="姓名" align="center"  min-width="5%"></el-table-column>
          <el-table-column prop="phone" label="手机号" min-width="8%" align="center"></el-table-column>
          <el-table-column prop="email" label="邮箱" min-width="8%" align="center"></el-table-column>
          <el-table-column prop="graduationSchool" label="毕业学校" min-width="8%" align="center"></el-table-column>
          <el-table-column prop="educationStr" label="学历" min-width="5%" align="center"></el-table-column>
          <el-table-column prop="expectedPosition" label="期望岗位" min-width="8%" align="center"></el-table-column>
          <el-table-column prop="expectedSalary" label="期望薪资" min-width="8%" align="center"></el-table-column>
          <el-table-column label="操作" min-width="22%" align="center">
            <template slot-scope="scope">
              <el-button  type="primary" @click="save(scope.row.id)"  size="mini">办理入职</el-button>
              <el-button  type="primary" @click="setDate(scope.row.id)"  size="mini">限定入职时间</el-button>
              <el-button  @click="query(scope.row.id)" icon="el-icon-search" size="mini"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination background layout="prev, pager, next"
                       :total="page.total" class="recruit-page"
                       :current-page="current" :page-size="page.size" style="margin:1rem 45%" @current-change="currentPage">
        </el-pagination>
      </el-card>

      <el-dialog title="入职时间" :visible.sync="flag" width="21rem">
        <el-form :model="date">
          <el-form-item label="入职时间" :label-width="150">
            <el-date-picker
              v-model="date.dateTime"
              type="date"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="flag = false">取 消</el-button>
          <el-button type="primary" @click="flag = false">确 定</el-button>
        </div>
      </el-dialog>

    </div>
  </div>
</template>

<script>
import {pagePersonAdopt} from "@/api/personnel";

export default {
  data(){
    return{
      current:1,
      pageSize:10,
      page:{},
      date:{},
      flag:false
    }
  },
  methods: {
    async pageAdopt(){
      const {data:res} = await pagePersonAdopt(this.current,this.pageSize)
      this.page = res.data
    },
    async currentPage(index){
      const {data:res} = await pagePersonAdopt(index,this.pageSize)
      this.page = res.data
    },
    save(id){
      this.$router.push({path:'/employees/saveOrEditEmp/'+id})
    },
    setDate(id){
      this.date.id = id
      this.flag = true
    },
    query(id){
      this.$router.push({path:'/personnel/info/'+id})
    }
  },
  created() {
    this.pageAdopt()
  }
}
</script>

<style scoped lang="scss">
.run{
&-container{
   position: relative;
 }
&-core{
   margin:3rem 15rem 0 15rem
 }
}
</style>
